<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>setup函数使用</title>
    <script src="../vue.global.js"></script>
</head>
<body>
<div id="app"></div>
<script>
    const app = Vue.createApp({
        data() {
            return {

            }
        },
        /**
         * created 实例被完全初始化之前
         */
        mounted(){
        },
        setup(props,context){
            console.log("setup",context);
            let {emit} = context;
            console.log("emit",emit);
            return {
                name:'dell',
                handleClick:()=>{
                    alert(123)
                }
            }
        },
        methods: {},
        template: `
          <div @click="handleClick">{{name}}</div>
        `
    });
    const vm = app.mount("#app");
</script>
</body>
</html>